<template>
  <div v-loading="!extendTypes||!formData">
    <el-form class="expand-form">
      <el-form-item v-for="item in extendTypes" :key="item.id" :label="item.alias">
        <span>{{ formData[item.name]||'' }}</span>
      </el-form-item>
    </el-form>
  </div>
</template>

<script>
import { getExtendTypes } from '@/api/zzxt/party-conference/confer-extend-fields'
export default {
  name: 'ConferenceExtendField',
  props: {
    formData: { type: Object, default: null }
  },
  data: () => ({
    conferType: null,
    extendTypes: null
  }),
  watch: {
    'formData.type': {
      handler(val) {
        if (!val) return
        this.conferType = val
        this.dataInit()
      },
      immediate: true
    }
  },
  methods: {
    dataInit() {
      getExtendTypes({ conferenceType: this.conferType }).then(data => {
        this.extendTypes = data.list
      })
    }
  }
}
</script>
<style lang="scss">
.expand-form label {
  width: 160px;
  color: #99a9bf;
}
</style>
